home *** CD-ROM | disk | FTP | other *** search
- /*
- ** CTCPAsyncCall.h
- **
- ** TurboTCP support library
- ** TCP asynchronous call class
- **
- ** Copyright © 1993-94, FrostByte Design / Eric Scouten
- **
- */
-
- #pragma once
-
- #include "TCL.h"
-
- #include <Types.h> // get <ConditionalMacros.h> if available
- #if (defined(GENERATINGPOWERPC) || defined(GENERATING68K))
- #include <MacTCP.h> // Universal Headers 2.0
- #else
- #include <TCPPB.h> // Univ Headers 1.0 or old headers
- #define GENERATINGCFM USESROUTINEDESCRIPTORS
- #endif
-
- #include "CTCPDriver.h"
- #include "TCPCompletionProc.h"
-
- class CTCPStream;
-
-
- /*______________________________________________________________________
- **
- ** CTCPAsyncCall
- **
- ** This object encapsulates each asynchronous call to MacTCP. This method is used so that
- ** the call’s I/O block may persist beyond the scope of the method call which originates the
- ** call (these methods are located in CTCPStream).
- **
- ** NOTE: All interaction with CTCPAsyncCalls should be through CTCPStream. No other class
- ** should have a reason to use this object, nor should this object be subclassed. Accordingly,
- ** all members of this class are declared private.
- **
- */
-
- #if defined(powerc) || defined (__powerc)
- #pragma options align=mac68k
- #endif
-
- class CTCPAsyncCall {
-
- friend class CTCPStream;
- friend class CTCPDriver;
-
- TCL_DECLARE_CLASS;
-
- private:
- CTCPStream& itsStream; // the stream that requested this call
- TurboTCPiopb itsiopb; // the TCP parm block, plus a few things (see "TCPCompletionProc.h")
-
- #if GENERATINGCFM
- static UniversalProcPtr completionProcUPP; // UPP for asynchronous completion proc
- #endif
-
-
- // constructor
-
- CTCPAsyncCall(CTCPStream& theStream)
- : itsStream(theStream)
- {
- itsiopb.itsQElem.qType = asyncCall;
- itsiopb.itsQElem.qSelfLink = this;
- }
-
-
- // initiate, process TCP call
-
- OSErr DoAsyncCall(short theCsCode, TCPiopb* theParamBlockPtr);
- OSErr DoAsyncCall(short theCsCode);
-
- void ProcessCompletion();
- Boolean Dispatch();
- Boolean DispatchNoCopyRcv();
-
-
- // completion procedure
-
- static void GetCompletionProc();
-
- #ifndef TCL_POWER_PC
- static pascal void CompletionProc();
- #else
- static pascal void CompletionProc(struct TurboTCPiopb* iopb);
- #endif
-
- };
-
- #if defined(powerc) || defined (__powerc)
- #pragma options align=reset
- #endif
-